﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;

namespace SobFS.Web.backend
{
    public partial class main : SobFS.Web.UI.BackendPage
    {
        protected string tmpInfo = "未设置未获取";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                tmpInfo = "获取数据中......";
            }
        }

        public string GetSystemInfo()
        {
            string cpuTotal = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS").ToString();
            string cpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").ToString();
            string vmMemory = (Environment.WorkingSet / 1024).ToString() + "M";
            string currentAppUseMemory = ((Double)GC.GetTotalMemory(false) / 1048576).ToString("N2") + "M";
            string aspNetUseMemory = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M";
            string aspNetUseCpu = ((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N2");
            string sessionCount = Session.Contents.Count.ToString();
            string sessionId = Session.Contents.SessionID;
            string currentOSUserName = Environment.UserName;

            return "当前应用使用内存：" + currentAppUseMemory;
        }

    }
}